# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test09
# Description:  例9.9
# Author:       ASUS
# Date:         2019/3/12
#-------------------------------------------------------------------------------


dict = {'name':'Bill','age':40}
try:
    print(dict['Age'])
except KeyError as e:                        #捕捉key不存在的异常
    print("异常信息：{}".format(e))

class WifiManager:
    def testWifi(self):
        print('testWifi')

wifiManager = WifiManager()
try:
    wifiManager.testWiFi()
except AttributeError as e:                   #捕捉对象属性（方法也可以看作对象的属性）不存在的异常
    print("异常信息：{}".format(e))